package io.jt808.proto.cmd;

import io.norland.buffer.AutoBuffer;
import io.norland.annotations.Proto;
import io.norland.proto.IProto;
import lombok.Data;

/**
 * 电话回拨
 */
@Proto("8400")
@Data
public class JT8400 implements IProto {
    /**
     * 标志,0:普通通话；1:监听
     */
    private byte flag;
    /**
     * 电话号码
     */
    private String phoneNo;

    public final byte[] writeToBytes() {
        AutoBuffer bytes = new AutoBuffer();
        bytes.writeByte(flag);
        bytes.writeString(phoneNo);
        return bytes.array();
    }

    public final void readFromBuf(AutoBuffer buffer) {
        flag = buffer.readByte();
        phoneNo = buffer.readString();
    }

}